package com.sealer.pattern.behavioral.interpreter;

/**
 * Created by sealer on 17/04/10.
 */
public class Variable implements Expression {
    private String name;

    public Variable(final String name) {
        this.name = name;
    }

    public int interpret(Context context) {
        if (null == context.getExp(name)) {
            return 0;
        } // Either return new Number(0).
        return context.getExp(name).interpret(context);
    }
}
